package day05;

import java.util.Arrays;

public class MaxofArray1 {
    public static void main(String[] args) {
        int[] array = new int[20];
        for (int s = 0; s < array.length-1;s++){
            array[s] = (int) (Math.random()*100);//存入数据
        }
        //数组最大值
        int w = array[0];
        for (int m = 1;m <array.length;m++){
            if (array[m]>w){
                w = array[m];
            }
        }
        System.out.println("最大值为"+w);
        //排序
        Arrays.sort(array);
        for (int x = 0;x <array.length;x++){
            System.out.println(array[x]);
        }
    }
}
